package cc.vv.btpartyjob.homepage.activity

import cc.vv.baselibrary.bean.base.BaseResponseObj
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.btpartyjob.homepage.delegate.HomePageBaseBinder
import cc.vv.btpartyjob.homepage.delegate.NoticeDetailActivityDelegate
import cc.vv.btpartyjob.homepage.moudel.resp.NoticeDetailResponseObj
import cc.vv.btpartyjob.homepage.server.HomeHttpServer
import cc.vv.mvp.activity.BaseActivityMVP
import cc.vv.mvp.binder.BaseDataBinder

/**
 * 通知公告详情
 * Created by Chen.qi on 2018/10/24.
 */
class NoticeDetailActivity : BaseActivityMVP<NoticeDetailActivityDelegate>() {
    /**
     * id
     */
    private var id: String? = null

    override fun initData() {
        try {
            viewDelegate?.setTitleBar("通知公告详情")
            id = intent.getStringExtra("id")
        } catch (e: Exception) {

        }
        HomeHttpServer.noticeDetailHttp(id, true)
    }

    override fun bindEvenListener() {


        viewDelegate?.setTitleBackBtnOnClick(object : BaseTopBarView.EventInterface {
            //返回
            override fun leftOnClick() {
                finish()
            }

            override fun leftCloseClick() {}
            override fun rightOnClick() {
            }
        })


    }

    override fun getDelegateClass(): Class<NoticeDetailActivityDelegate> {
        return NoticeDetailActivityDelegate::class.java
    }

    override fun getDataBinder(): BaseDataBinder<*, *> {
        return HomePageBaseBinder()
    }

    override fun getData(obj: BaseResponseObj<*>?) {
        super.getData(obj)
        when (obj) {
            is NoticeDetailResponseObj -> {
                val data = obj.data
//                viewDelegate?.setTitle(data?.title)
//                viewDelegate?.setTime(data?.createTime)
                viewDelegate?.setVebView(data?.html)
            }
        }
    }

    override fun getBadCode(obj: BaseResponseObj<*>?) {
        super.getBadCode(obj)
//        LKToastUtil.showToastShort(obj?.statusMessage)
    }
}